﻿using Microsoft.EntityFrameworkCore;

namespace FrameWork.DataHelper;

public static class Valid
{
    /**
     * 校验Id有效性
     */
    public static async Task<T> ValidId<T>(DbSet<T> table, string id) where T : class
    {
        //判空
        if (string.IsNullOrEmpty(id)) return null;

        //校验Id有效性
        var query = await table.FindAsync(Guid.Parse(id));
        return query;
    }
}